package cn.lhq.controller.user;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.lhq.bean.User;
import cn.lhq.bean.VoteResult;
import cn.lhq.service.UserServiceImpl;

@Controller
@RequestMapping("/user")
public class CreateUserController {
	@Resource
	UserServiceImpl userServiceImpl;
	
	@RequestMapping("/createUser.do")
	@ResponseBody
	public VoteResult createUser(String username,String password,Integer role) throws Exception{
		User user = new User();
		System.out.println("Controller");
		//user.setId(id);
		user.setUsername(username);
		user.setPassword(password);
		user.setRole(role);
		user.setError_count(0);
		VoteResult result = userServiceImpl.createUser(username,password,role);
		return result;
	}	
	
}
